using MicroMsg.Common.Utils;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
namespace MicroMsg.Storage
{
	public class TloLocation : TloXmlItem
	{
		public float fLongitude;
		public float fLatitude;
		public string strCountry;
		public string strCity;
		public string strProvince;
		public string strName;
		public int nScale;
		public TloLocation()
		{
		}
		public TloLocation(XElement xelement_0)
		{
			this.parse(xelement_0);
		}
		public bool parse(XElement xelement_0)
		{
			using (IEnumerator<XAttribute> enumerator = xelement_0.Attributes().GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					XAttribute current = enumerator.get_Current();
					if (current.get_Name() == "longitude")
					{
						this.fLongitude = (float)current;
					}
					else
					{
						if (current.get_Name() == "latitude")
						{
							this.fLatitude = (float)current;
						}
						else
						{
							if (current.get_Name() == "country")
							{
								this.strCountry = (string)current;
							}
							else
							{
								if (current.get_Name() == "city")
								{
									this.strCity = (string)current;
								}
								else
								{
									if (current.get_Name() == "province")
									{
										this.strProvince = (string)current;
									}
									else
									{
										if (current.get_Name() == "scale")
										{
											this.nScale = (int)current;
										}
										else
										{
											Log.smethod_4("TimeLineObject", "unknown AppInfo tag=" + current.get_Name());
										}
									}
								}
							}
						}
					}
				}
			}
			return true;
		}
		public XElement toXElement()
		{
			XElement xElement = new XElement("location");
			xElement.Add(new XAttribute("longitude", this.fLongitude));
			xElement.Add(new XAttribute("latitude", this.fLatitude));
			if (!string.IsNullOrEmpty(this.strCountry))
			{
				xElement.Add(new XAttribute("country", this.strCountry));
			}
			if (!string.IsNullOrEmpty(this.strCity))
			{
				xElement.Add(new XAttribute("city", this.strCity));
			}
			if (!string.IsNullOrEmpty(this.strProvince))
			{
				xElement.Add(new XAttribute("province", this.strProvince));
			}
			xElement.Add(new XAttribute("scale", this.nScale));
			return xElement;
		}
	}
}
